<HTML>
<HEAD>
<TITLE>
BeanProperty.h
</TITLE>
</HEAD>
<BODY>
<PRE>
<font color="green">/*
* Copyright 2006 the original author or authors.
* 
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* 
*      http://www.apache.org/licenses/LICENSE-2.0
* 
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/</font>

<font color="blue">#ifndef</font> AUTUMN_BEANPROPERTY_H
<font color="blue">#define</font> AUTUMN_BEANPROPERTY_H

<font color="blue">#include</font> <font color="maroon">&#60;string&#62;</font>
<font color="blue">#include</font> <font color="maroon">"Basic.h"</font>
<font color="blue">#include</font> <font color="maroon">"IBeanWrapper.h"</font>
<font color="blue">#include</font> <font color="maroon">"TypeManager.h"</font>

<font color="blue">using</font> <font color="blue">namespace</font> std;

<font color="blue">namespace</font> Autumn<font color="black">{</font>

<font color="green">/** 
 * Bean's property which will be set.
 * @version 0.1.0
 * @since 2006-11-22
 */</font>
<font color="blue">class</font> BeanProperty <font color="black">{</font>
<font color="blue">private</font><font color="black">:</font>
    
    <font color="green">/** Property's name */</font>
    string Name;

    <font color="green">/** Property's type */</font>
    string Type;
    
    <font color="green">/** String list presenting parameter value */</font>
    StrValueList StrValue;
    
    <font color="green">/** Managed by Autumn framework or not, it is allways true now. */</font>
    <font color="blue">bool</font> Managed;

    <font color="green">/** UNUSED NOW. the type is a ref of bean or not  */</font>
    <font color="blue">bool</font> IsBeanRef;
    
<font color="blue">public</font><font color="black">:</font>
    BeanProperty<font color="black">(</font><font color="blue">const</font> string<font color="black">&</font> <font color="blue">name</font>, <font color="blue">const</font> string<font color="black">&</font> type, StrValueList<font color="black">&</font> vl,
                <font color="blue">bool</font> r, <font color="blue">bool</font> b<font color="black">=</font><font color="blue">true</font><font color="black">)</font><font color="black">:</font>
      Name<font color="black">(</font><font color="blue">name</font><font color="black">)</font>, Type<font color="black">(</font>type<font color="black">)</font>, StrValue<font color="black">(</font>vl<font color="black">)</font>, IsBeanRef<font color="black">(</font>r<font color="black">)</font>, Managed<font color="black">(</font>b<font color="black">)</font><font color="black">{</font> <font color="black">}</font>

    <font color="green">/** 
     * Set a object's property.
     * @param pw The object's wrapper to be set
     * @param tm The type manager to generate value
     */</font>
    <font color="blue">void</font> setProperty<font color="black">(</font>IBeanWrapper<font color="black">*</font> pw, TypeManager<font color="black">*</font> tm<font color="black">)</font>;

    <font color="green">/** 
     * Take out a property's value.
     * @param pw The object's wrapper to manage the value
     * @param tm The type manager to generate value
     */</font>
    <font color="blue">void</font><font color="black">*</font> takeoutValue<font color="black">(</font>IBeanWrapper<font color="black">*</font> pw, TypeManager<font color="black">*</font> tm<font color="black">)</font>;

    <font color="green">/** Set property's type if it is empty */</font>
    <font color="blue">void</font> setType<font color="black">(</font>string type<font color="black">)</font><font color="black">{</font>
        <font color="blue">if</font><font color="black">(</font> <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>Type.empty<font color="black">(</font><font color="black">)</font> <font color="black">)</font>
            <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>Type <font color="black">=</font> type;
    <font color="black">}</font>
<font color="black">}</font>;

<font color="black">}</font> <font color="green">// End namespace Autumn</font>
<font color="blue">#endif</font>

</PRE>
</BODY>
</HTML>
